package com.ivo.web.form.def;

import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;

import com.ivo.util.StringUtil;
import com.ivo.web.form.intf.Field;

public class TextArea extends TextField implements Field
{
	@Override
	public String toHtml()
	{
		Document document = DocumentHelper.createDocument();
		Element div = document.addElement( "textarea" );
		//-------------------------------------------------------------------------------------
		if( StringUtil.notEmpty( id ) ) div.addAttribute( "id", id );
		if( StringUtil.notEmpty( name ) ) div.addAttribute( "name", name );
		if( StringUtil.notEmpty( style ) ) div.addAttribute( "style", style );
		if( StringUtil.notEmpty( css ) ) div.addAttribute( "css", css );
		if( StringUtil.notEmpty( width ) ) div.addAttribute( "width", width );
		if( StringUtil.notEmpty( height ) ) div.addAttribute( "height", height );
		if( StringUtil.notEmpty( value ) ) div.addText( value );
		//-------------------------------------------------------------------------------------
		return div.asXML();
	}
}
